<template>
	<el-container>
		<el-main class='x-main-edit'>
			<el-form ref="form" :rules="form_rules" :model="form" size="mini" label-width="15%">
				<el-tabs type="border-card" v-model="page_tag">
					<!---->
					<!---->
					<el-tab-pane :label="page_info.title" name="1">
						<el-form-item label="无忧保障说明">
							<Tinymce menubar="" v-model="form.safe_txt" :height="350" ref="safe_txt"></Tinymce>
						</el-form-item>
						<el-form-item label="无忧保障提示文字">
							<el-input type="textarea" v-model="form.safe_title" class="x-input-60" placeholder=""></el-input>
						</el-form-item>
						<el-form-item label="保证金">
							<el-input-number v-model="form.abc_num_00" :min="0.01" :step="0.01" :precision="2"></el-input-number>
						</el-form-item>
						<el-form-item label="每日预约用车总量">
							<el-input-number v-model="form.abc_int_00" :min="0" :step="1"></el-input-number>
							<div class="x-alert">
								<span>当天预约总量超过{{ form.abc_int_00 }}次，客户不能预约用车</span>
							</div>
						</el-form-item>
						<el-form-item label="客服电话">
							<el-input v-model="form.customer_phone" class="x-input-60" placeholder=""></el-input>
						</el-form-item>
						<el-form-item label="审核结果通知">
							<Subscribemsg ref="abc_str_00"></Subscribemsg>
							<div class="x-alert">
								<span>占位符：</span><br/>
								<span>审核时间：{state_date}</span><br/>
								<span>审核结果：{state}</span><br/>
								<span>客户姓名：{cuser_name}</span><br/>
							</div>
						</el-form-item>
						<el-form-item label="用车成功通知">
							<Subscribemsg ref="abc_str_01"></Subscribemsg>
							<div class="x-alert">
								<span>占位符：</span><br/>
								<span>车牌号：{car_no}</span><br/>
								<span>车型：{spu_name}</span><br/>
								<span>订单号：{order_id}</span><br/>
								<span>用车时间：{use_date}</span><br/>
							</div>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
					<el-tab-pane label="用车详情" name="2">
						<el-form-item label="用车指南">
							<Tinymce menubar="" v-model="form.use_car" :height="350" ref="use_car"></Tinymce>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
					<el-tab-pane label="网点" name="3">
						<el-form-item label="网点列表轮播图">
							<ItemList :max="6" ref="abc_str_03"></ItemList>
							<div class="x-alert">
								<span>提示：可以用鼠标拖拽改变排序</span>
							</div>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
					<el-tab-pane label="高级" name="10">
						<el-form-item label="腾讯地图apikey">
							<el-input v-model="form.abc_str_02" class="x-input-60" placeholder=""></el-input>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
					<el-tab-pane v-if="false" label="模板" name="2">
						<el-form-item label="应用模板" prop="reply_app_file" ref="reply_app_file">
							<el-col :span="6">
								<el-input v-model="form.reply_app_file" placeholder="默认：t_001"/>
							</el-col>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
				</el-tabs>
				<!---->
				<!---->
			</el-form>
			<!---->
			<!---->
			<!-- 按钮部分 -->
			<div class="save_wrap">
				<!--				<el-button @click="funcTest" size="mini">test</el-button>-->
				<!--				<el-button @click="g_page.funcBack" size="mini">返回</el-button>-->
				<el-button type="success" @click="g_page.funcSave" size="mini">保存</el-button>
				<el-checkbox v-if="page_info.is_admin_edit" style="margin-left: 10px;" label="保存后停留" v-model="checked"/>
			</div>
			<!---->
			<!---->
			<!---->
		</el-main>
	</el-container>
</template>

<script>
	import ItemList from '@/components/CompItem/ItemList'
	import Tinymce from '@/components/Tinymce'
	import Subscribemsg from '@/components/CompSubscribemsg/Subscribemsg'

	export default {
		components: {
			ItemList,
			Tinymce,
			Subscribemsg
		},
		data() {
			let page_data = { pid: '' }
			//
			page_data = this.g_cc.funcGetInitData(page_data)
			//
			return page_data
		},
		mounted() {
			console.log('mounted', this._uid)
			console.log(this.$route.query)

			this.g_page.funcSetVue(this)
			//
			this.g_page.funcSetApiUrlEdit('/xadmin/app_car/app_car__setting')
			this.g_page.funcSetApiUrlSave('/xadmin/app_car/app_car__setting/save')
			let page = this
			//验证
			this.form_rules = {
				__test: [{
					required: true,
					message: '请输入原密码',
					trigger: 'blur'
				}]
			}

			let data = this.$route.query
			this.g_page.funcEdit(data)
		},
		methods: {
			funcTest() {
				console.log(this.$route.fullPath)
				// let url = `/302?callback_url=${encodeURIComponent(this.$route.fullPath)}`
				this.g_cc.func_redirect(this.$route.fullPath)
			},
			funcShowDialogAfter() {
				this.$nextTick(() => {
					this.$refs['abc_str_00'].funcInit(this.form.abc_str_00)
					this.$refs['abc_str_01'].funcInit(this.form.abc_str_01)
					//
					this.$refs['abc_str_03'].funcInit(this.form.abc_str_03)
					// debugger
					setTimeout(() => {
						this.$refs['safe_txt'].setContent(this.form.safe_txt)
						this.$refs['use_car'].setContent(this.form.use_car)
						this.$refs['find_car'].setContent(this.form.find_car)
					}, 200)
				})
			},
			//保存之前
			funcSaveBefore(data) {
				console.log('funcSaveBefore', data)

				return data
			}
			////////////////
		}
	}
</script>
